#include <xp/bas/string.h>
#include <xp/bas/stdlib.h>
#include <xp/bas/stdio.h>

int xp_main (int argc, xp_char_t* argv[])
{
	int dir;
	xp_size_t steps, n;

	if (argc != 4) {
		xp_printf (XP_TEXT("usage: %s string direction steps\n"), argv[0]);
		xp_printf (XP_TEXT("where direction := {-1 | 0 | 1}\n"));
		xp_printf (XP_TEXT("      steps := integer\n"));
		return -1;
	}

	XP_STRTOI (dir, argv[2], XP_NULL, 10);
	XP_STRTOI (steps, argv[3], XP_NULL, 10);

	xp_printf (XP_TEXT("xp_strrot (%s, %d, %lu) => "), 
		argv[1], dir, (unsigned long)steps);
	n = xp_strrot (argv[1], dir, steps);
	xp_printf (XP_TEXT("[%s], %lu\n"), argv[1], (unsigned long)n);

	return 0;

}
